package com.nwpu.coursesupport.mapper;


import com.nwpu.coursesupport.entity.FinalExamTaskEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author shun
 * @email ws2017303035@mail.nwpu.edu.cn
 * @date 2020-08-04 21:33:50
 */
@Mapper
public interface FinalExamTaskDao {
    @Insert({" insert into final_exam_task values (null, #{courseId},#{testNum},#{titleNum},#{isSelect},#{selectAnswer},#{fullMark},#{average})"})
    @Options(keyProperty = "id", keyColumn = "id", useGeneratedKeys = true)
    Integer save(FinalExamTaskEntity finalExamTaskEntity);

    @Select("select * from final_exam_task where course_id=#{courseId}")
    List<FinalExamTaskEntity> findByCourseId(@Param("courseId") Integer courseId);

    @Delete("delete from final_exam_task where id=#{id}")
    void deleteById(@Param("id") Integer id);

    @Select("select * from final_exam_task where id=#{finalExamTaskId}")
    FinalExamTaskEntity findById(@Param("finalExamTaskId") Integer finalExamTaskId);
}
